<?php
class ScriptsController extends Zendvn_Controller_Action{
	private $_paning = array('rowCount' => 20, 'pageRange' => 5);
	public function init(){
		parent::init();		
		$this->_templateObj->setPath(TEMPLATE_PATH . '/public/default');		
		$this->_templateObj->load();	
		
		/*====================================================
		 * Load Zendvn Translate for Controller
		 *====================================================*/
		$this->_langObj->setLangFile(array('validate.tmx'));		
		Zend_Registry::set('Zend_Translate',$this->_langObj->generate());
		
		/*====================================================
		 * Thiet lap gia tri cho phan phan trang cua controlle
		 *====================================================*/
		$pageNumber = $this->_request->getParam('page',1);
		$this->_paning['page'] = $pageNumber;
		$this->_arrParam['panigator'] = $this->_paning;
		$this->view->arrParam = $this->_arrParam;
	}
	
	public function createImageAction(){
		require_once SCRIPTS_PATH . '/resize/resize.php';
		
		$name     = base64_decode($this->_arrParam['name']);
		
		$width    = $this->_arrParam['width'];
		$heigh    = $this->_arrParam['heigh'];
		$type     = $this->_arrParam['type'];
		$resize = new resize($name);
		$resize->resizeImage($width, $heigh, $type);
		$resize->showImage();
		
		$this->_helper->viewRenderer->setNoRender();
		$this->_helper->layout->disableLayout();
	}
}